import request from '@/utils/request'

// 保存缓存
export function saveDistricts(data) {
  return request({
    url: '/app/district/saveDistrict',
    method: 'post',
    data: data
  })
}

export function saveQyCache(data) {
  return request({
    url: '/app/district/saveQyCache',
    method: 'post',
    data: data
  })
}

/** 重置乡镇区域 */
export function resetTownDistrict(data) {
  return request({
    url: '/app/district/resetTownDistrict',
    method: 'post',
    data: data
  })
}

/** 重置区县区域 */
export function resetDistrict(data) {
  return request({
    url: '/app/district/resetDistrict',
    method: 'post',
    data: data
  })
}

export function listDistrict(query) {
  return request({
    url: '/app/district/queryDistrict',
    method: 'get',
    params: query
  })
}

export function getDistrictByCity(query) {
  return request({
    url: '/app/district/getDistrictByCity',
    method: 'get',
    params: query
  })
}

// 删除围栏坐标
export function delDistrict(data) {
  return request({
    url: '/app/district/delDistrict',
    method: 'post',
    data: data
  })
}

export function getLocalDistrictByCity(query) {
  return request({
    url: '/app/district/getLocalDistrictByCity',
    method: 'get',
    params: query
  })
}


export function checkDistrict(data){
  return request({
    url: '/app/district/checkDistrict',
    method: 'post',
    data: data
  })
}

// 生成围栏坐标
export function genQyPoints(data) {
  return request({
    url: '/app/gaode/genFencePoints',
    method: 'post',
    data: data
  })
}

// 获取角色列表
export function getTowsPopByRole() {
  return request({
    url: '/app/district/getTowsPopByRole',
    method: 'get'
  })
}

// 复制乡镇围栏
export function copyTownOrDistrict(data) {
  return request({
    url: '/app/district/copyTownOrDistrict',
    method: 'post',
    data: data
  })
}
// 检查是否已被复制
export function checkIsCopy(data) {
  return request({
    url: '/app/district/checkIsCopy',
    method: 'post',
    data: data
  })
}
